(function(window){window.BX=window["BX"]||{};if(window.BX["UploaderUtils"])return false;var BX=window.BX;BX.UploaderLog=[];BX.UploaderDebug=false;var statuses={new:0,ready:1,preparing:2,inprogress:3,done:4,failed:5,stopped:6,changed:7,uploaded:8};BX.UploaderUtils={statuses:statuses,getId:function(){return(new Date).valueOf()+Math.round(Math.random()*1e6)},log:function(){if(BX.UploaderDebug===true){console.log(arguments)}else{BX.UploaderLog.push(arguments)}},Hash:function(){var e=function(){this.length=0;this.items={};this.order=[];var e;if(arguments.length==1&&BX.type.isArray(arguments[0])&&arguments[0].length>0){var t=arguments[0];for(e=0;e<t.length;e++){if(t[e]&&typeof t[e]=="object"&&t[e]["id"]){this.setItem(t[e]["id"],t[e])}}}else{for(e=0;e<arguments.length;e+=2)this.setItem(arguments[e],arguments[e+1])}};e.prototype={getIds:function(){return this.order},getQueue:function(e){e+="";return BX.util.array_search(e,this.order)},getByOrder:function(e){return this.getItem(this.order[e])},removeItem:function(e){e+="";var t,i;if(typeof this.items[e]!="undefined"){t=this.items[e];i=this.getQueue(e);this.pointer-=this.pointer>=i?1:0;delete this.items[e];this.order=BX.util.deleteFromArray(this.order,i);this.length=this.order.length}return t},getItem:function(e){e+="";return this.items[e]},unshiftItem:function(e,t){e+="";if(typeof t!="undefined"){if(typeof this.items[e]=="undefined"){this.order.unshift(e);this.length=this.order.length}this.items[e]=t}return t},setItem:function(e,t){e+="";if(typeof t!="undefined"){if(typeof this.items[e]=="undefined"){this.order.push(e);this.length=this.order.length}this.items[e]=t}return t},hasItem:function(e){e+="";return typeof this.items[e]!="undefined"},insertBeforeItem:function(e,t,i){e+="";if(typeof t!="undefined"){if(typeof this.items[e]=="undefined"){this.order.splice(this.getQueue(i),0,e);this.length=this.order.length}this.items[e]=t}return t},getFirst:function(){var e,t=null;for(var i=0;i<this.order.length;i++){e=this.order[i];if(!!e&&this.hasItem(e)){t=this.getItem(e);break}}return t},getNext:function(){this.pointer=0<=this.pointer&&this.pointer<this.order.length?this.pointer:-1;var e=this.getItem(this.order[this.pointer+1]);if(!!e)this.pointer++;else this.pointer=-1;return e},getPrev:function(){this.pointer=0<=this.pointer&&this.pointer<this.order.length?this.pointer:0;var e=this.getItem(this.order[this.pointer-1]);if(!!e)this.pointer--;return e},reset:function(){this.pointer=-1},setPointer:function(e){this.pointer=this.getQueue(e);return this.pointer},getLast:function(){var e,t=null;for(var i=this.order.length;i>=0;i--){e=this.order[i];if(!!e&&this.hasItem(e)){t=this.getItem(e);break}}return t}};return e}(),getFileNameOnly:function(e){var t="\\",i=e.lastIndexOf(t),n=e.length;if(i==-1){t="/";i=e.lastIndexOf(t)}if(i+1==e.length){n=i;i=e.substring(0,n).lastIndexOf(t)}e=e.substring(i+1,n);if(t=="/"&&e.indexOf("?")>0){e=e.substring(0,e.indexOf("?"))}if(e=="")e="noname";return e},isImageExt:function(e){return BX.message("bxImageExtensions")&&BX.type.isNotEmptyString(e)?new RegExp("(?:^|\\W)("+e+")(?:\\W|$)","gi").test(BX.message("bxImageExtensions")):false},isImage:function(e,t,i){i=BX.type.isNumber(i)?i:BX.type.isNotEmptyString(i)&&!/[\D]+/gi.test(i)?parseInt(i):null;return(t===null||(t||"").indexOf("image/")===0)&&(i===null||i<20*1024*1024)&&BX.UploaderUtils.isImageExt((e||"").lastIndexOf(".")>0?e.substr(e.lastIndexOf(".")+1).toLowerCase():"")},scaleImage:function(e,t,i){var n=parseInt(e["width"]),r=parseInt(e["height"]);i=!i&&!!t["type"]?t["type"]:i;t=!!t?t:{};t.width=parseInt(!!t.width?t.width:0);t.height=parseInt(!!t.height?t.height:0);var s={bNeedCreatePicture:false,source:{x:0,y:0,width:0,height:0},destin:{x:0,y:0,width:0,height:0}},o,a;if(!(n>0||r>0)){BX.DoNothing()}else{if(!BX.type.isNotEmptyString(i)){i="inscribed"}var h,f;if(i.indexOf("proportional")>=0){o=Math.max(n,r);a=Math.min(n,r)}else{o=n;a=r}if(i=="exact"){var l=n/r<t["width"]/t["height"]?t["width"]/n:t["height"]/r,u=Math.max(0,Math.round(n/2-t["width"]/2/l)),d=Math.max(0,Math.round(r/2-t["height"]/2/l));s.bNeedCreatePicture=true;s.coeff=l;s.destin["width"]=t["width"];s.destin["height"]=t["height"];s.source["x"]=u;s.source["y"]=d;s.source["width"]=Math.round(t["width"]/l,0);s.source["height"]=Math.round(t["height"]/l,0)}else{if(i=="circumscribed"){h={width:o>0?t["width"]/o:1,height:a>0?t["height"]/a:1};f=Math.max(h["width"],h["height"],1)}else{h={width:o>0?t["width"]/o:1,height:a>0?t["height"]/a:1};f=Math.min(h["width"],h["height"],1);f=0<f?f:1}s.bNeedCreatePicture=f!=1;s.coeff=f;s.destin["width"]=Math.max(1,parseInt(f*n));s.destin["height"]=Math.max(1,parseInt(f*r));s.source["x"]=0;s.source["y"]=0;s.source["width"]=n;s.source["height"]=r}}return s},dataURLToBlob:function(e){var t=";base64,",i,n,r,s;if(e.indexOf(t)==-1){i=e.split(",");n=i[0].split(":")[1];r=i[1];return new Blob([r],{type:n})}i=e.split(t);n=i[0].split(":")[1];r=window.atob(i[1]);s=r.length;var o=new Uint8Array(s);for(var a=0;a<s;++a){o[a]=r.charCodeAt(a)}return new Blob([o],{type:n})},sizeof:function(e){var t=0,i;for(i in e){if(e.hasOwnProperty(i)){t+=i.length;if(typeof e[i]=="object"){if(e[i]===null)BX.DoNothing();else if(e[i]["size"]>0)t+=e[i].size;else t+=BX.UploaderUtils.sizeof(e[i])}else if(typeof e[i]=="number"){t+=e[i].toString().length}else if(!!e[i]&&e[i].length>0){t+=e[i].length}}}return t},FormToArray:function(e,t){return BX.ajax.prepareForm(e,t)},getFormattedSize:function(e,t){var i=["b","Kb","Mb","Gb","Tb"],n=0;while(e>=1024&&n<4){e/=1024;n++}return Math.round(e*(t>0?t*10:1))/(t>0?t*10:1)+" "+BX.message("FILE_SIZE_"+i[n])},bindEvents:function(obj,event,func){var funcs=[],ii;if(typeof func=="string"){eval("funcs.push("+func+");")}else if(!!func["length"]&&func["length"]>0){for(ii=0;ii<func.length;ii++){if(typeof func[ii]=="string")eval("funcs.push("+func[ii]+");");else funcs.push(func[ii])}}else funcs.push(func);if(funcs.length>0){for(ii=0;ii<funcs.length;ii++){BX.addCustomEvent(obj,event,funcs[ii])}}},applyFilePart:function(e,t){if(BX.type.isDomNode(e)){e.uploadStatus=statuses.done}else if(e==t){e.uploadStatus=statuses.done}else if(e.blobed===true){e.uploadStatus=e.package+1>=e.packages?statuses.done:statuses.inprogress;if(e.uploadStatus==statuses.inprogress)e.package++}return true},getFilePart:function(e,t){var i,n=t,r,s;if(BX.type.isDomNode(e)){i=e}else if(t<=0||e.size<=t){i=e}else if(e["packages"]&&e["packages"]<=e["package"]){i=null}else if(window.Blob||window.MozBlobBuilder||window.WebKitBlobBuilder||window.BlobBuilder){if(e["packages"]){e.package++;r=e.package*n;s=r+n}else{e.packages=Math.ceil(e.size/n);e.package=0;r=0;s=n}if("mozSlice"in e)i=e.mozSlice(r,s,e.type);else if("webkitSlice"in e)i=e.webkitSlice(r,s,e.type);else if("slice"in e)i=e.slice(r,s,e.type);else i=e.Slice(r,s,e.type);for(var o in e){if(e.hasOwnProperty(o)){i[o]=e[o]}}i["name"]=e["name"];i["start"]=r;i["package"]=e.package;i["packages"]=e.packages}return i},makeAnArray:function(e,t){e=!!e?e:{files:[],props:{}};var i;for(var n in t){if(t.hasOwnProperty(n)){if(typeof t[n]=="object"&&t[n].length>0){e[n]=!!e[n]?e[n]:[];for(i=0;i<t[n].length;i++){e[n].push(t[n][i])}}else{for(i in t[n]){if(t[n].hasOwnProperty(i)){e[n]=!!e[n]?e[n]:{};e[n][i]=t[n][i]}}}}}return e},appendToForm:function(e,t,i){if(!!i&&typeof i=="object"){for(var n in i){if(i.hasOwnProperty(n)){BX.UploaderUtils.appendToForm(e,t+"["+n+"]",i[n])}}}else{e.append(t,!!i?i:"")}},FormData:function(){return new(BX.Uploader.getInstanceName()=="BX.UploaderSimple"?FormDataLocal:window.FormData)},prepareData:function(e){var t={};if(null!=e){if(typeof e=="object"){for(var i in e){if(e.hasOwnProperty(i)){var n=BX.util.urlencode(i);if(typeof e[i]=="object")t[n]=BX.UploaderUtils.prepareData(e[i]);else t[n]=BX.util.urlencode(e[i])}}}else t=BX.util.urlencode(e)}return t}};var FormDataLocal=function(){var e;do{e=Math.floor(Math.random()*99999)}while(BX("form-"+e));this.local=true;this.form=BX.create("FORM",{props:{id:"form-"+e,method:"POST",enctype:"multipart/form-data",encoding:"multipart/form-data"},style:{display:"none"}});document.body.appendChild(this.form)};FormDataLocal.prototype={append:function(e,t){if(BX.type.isDomNode(t)){this.form.appendChild(t)}else{this.form.appendChild(BX.create("INPUT",{props:{type:"hidden",name:e,value:t}}))}}};BX.UploaderUtils.slice=function(e,t,i){var n=null;if("mozSlice"in e)n=e.mozSlice(t,i);else if("webkitSlice"in e)n=e.webkitSlice(t,i);else if("slice"in e)n=e.slice(t,i);else n=e.Slice(t,i,e.type);return n};BX.UploaderUtils.readFile=function(e,t,i){if(window["FileReader"]){var n=new FileReader;n.onload=n.onerror=t;i=i||"readAsDataURL";if(n[i]){n[i](e);return n}}return false}})(window);
//# sourceMappingURL=common.map.js